package com.itheima.dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface ReportDao {

    /**
     * 按月查询 between yyyy-MM-01 ~ yyyy-MM-31
     * @param startTime
     * @param endTime
     * @return
     */
    @Select("select count(id) from t_member where regTime between #{startTime} and #{endTime}")
    public int getMemberCountByYear(@Param("startTime") String startTime, @Param("endTime") String endTime);

    /**
     * 多表、内连接、distinct（去重）、分组、计数
     * @return 集合
     */
    @Select("select ts.name name,count(distinct tor.id) value from t_order tor,t_setmeal ts,t_member tm where tor.orderStatus='已到诊' and ts.id=tor.setmeal_id group by tor.setmeal_id")
    public List<Map<String,String>> getSetmealReport();
}
